<?php

namespace app\api\controller\v1;

use app\BaseController;
// 引入jwt插件
use thans\jwt\facade\JWTAuth;

class Userx extends BaseController
{
  public function login()
  {
    // 生成token
    $token = JWTAuth::builder(['uid' => 1, 'name' => 'ceshi']);
    return $token;

    $tokenStr = JWTAuth::token()->get(); //可以获取请求中的完整token字符串
    $payload = JWTAuth::auth(); //可验证token, 并获取token中的payload部分
    $uid = $payload['uid']; //可以继而获取payload里自定义的字段，比如uid
  }
//   public function getUserInfo() {
//     return json(['id'=>1, 'name'=> '啦啦啦']);
//  }
 
}
